package face.pay.dao;
import	java.lang.reflect.Parameter;

import face.pay.entity.UserInfo;
import face.pay.vo.ProfitUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface UserInfoDao {

    UserInfo getByUserName(@Param(value = "userName") String userName);

    UserInfo getByUserNameAndOemId(@Param(value = "userName") String userName,@Param(value = "oemId") Integer oemId );

    @Select("select count(*) from  user where user_name =#{userName} and oem_id=#{oemId}")
    Integer countByOemAndUserName(@Param(value = "oemId") Integer oemId,@Param(value = "userName") String userName);

    Integer countByOemIdAndTypeAndPhone(@Param(value = "oemId")Integer oemId,@Param(value = "type")String type,@Param(value = "mobile")String mobile,@Param("deleted")Integer deleted);

    UserInfo queryUser(UserInfo user);


    UserInfo getById(@Param(value = "id" ) Integer id);

    void insert(UserInfo userInfo);

    void update(UserInfo userInfo);

    void updatePassword(UserInfo userInfo);

    List<UserInfo> queryList(UserInfo userInfo);

    List<UserInfo> queryUserWithPar(UserInfo userInfo);

    List<UserInfo> queryDetailList(UserInfo userInfo);

    ProfitUser getUserWithMchProfit(@Param(value = "id") Integer userId);

    ProfitUser getUserWithLevelProfit(@Param(value = "id")Integer userId);

    ProfitUser getOemUserByOemId(@Param(value = "oemId")Integer oemId);


    void updateUserInfo(UserInfo userInfo);



    void mobileModify(UserInfo user);

    /**
     * 统计商家或代理个数
     * @param record
     * @return
     */
    Integer countEnterpriseOrAgency(Map<String, Object> record);

    /**
     * 修改用户删除标记  0：未删除 1：已删除
     * @param userInfo
     */
    int deleted(UserInfo userInfo);

    /**
     * 修改用户状态 -1：锁定 0：过期 1：正常
     * @param userInfo
     * @return
     */
    int updateUserState(UserInfo userInfo);

    /**
     * 修改代理商推荐人
     * @param userInfo
     */
    int updateRecommendId(UserInfo userInfo);

    /**
     * 修改用户基本信息
     * @param userInfo
     */
    void modifyUserInfo(UserInfo userInfo);

}
